package com.xr.enums;

/**
 * @author Arnold Yand
 * @summary ID类型
 *  用于在IdUtil在根据类型生成ID
 *  code即IdGenerator.groupId，10bits最大支持1023种
 * @time 2018/11/7 9:43
 */
public enum IdType {

  DEFAULT(0, "默认"),
  ;

  private int code;
  private String label;
  private IdType(int code, String label){
    this.code = code;
    this.label = label;
  }

  public IdType parse(int code){
    for(IdType v : IdType.values()){
      if(v.code == code){
        return v;
      }
    }

    return DEFAULT;
  }

  public int getCode() {
    return code;
  }

  public String getLabel() {
    return label;
  }
}
